package com.qtummatrix.service.impl;

import com.qtummatrix.dao.ModelDao;
import com.qtummatrix.service.ModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * create by Gongshiyong  2019-12-07 11:31
 */
@Service
public class ModelServiceImpl implements ModelService {

    @Autowired
    private ModelDao modelDao;

    public List<Map<String, Object>> getAllproductBankName() {
        List<Map<String, Object>> allBankName = modelDao.getAllproductBankName();
        return allBankName;
    }

    public List<Map<String, Object>> getAllproductSerie() {
        List<Map<String, Object>> allSerie = modelDao.getAllproductSerie();
        return allSerie;
    }

    public List<Map<String, Object>> getAllproductName() {
        List<Map<String, Object>> allProductName = modelDao.getAllproductName();
        return allProductName;
    }

    public List<Map<String, Object>> getAllcustomType() {
        List<Map<String, Object>> allCustomType = modelDao.getAllcustomType();
        return allCustomType;
    }

    public List<Map<String, Object>> getAllmodelState() {
        List<Map<String, Object>> allState = modelDao.getAllmodelState();
        return allState;
    }

    public List<Map<String, Object>> getModelList(int bankid, String modelName, int seriesid, int product,
                                                  int customType, int state, int pageNo, int pageSize) {
        List<Map<String, Object>> modelList = modelDao.getModelList(bankid, modelName, seriesid, product, customType,
                state, pageNo, pageSize);
        return modelList;
    }

    public Integer getModelSize(int bankid, String modelName, int seriesid, int product, int customType, int state) {
        Integer modelSize = modelDao.getModelSize(bankid, modelName, seriesid, product, customType, state);
        return modelSize;
    }

    public int updateModelState(int id, int state) {
        int count = modelDao.updateModelState(id, state);
        return count;
    }

    @Override
    public int addModel(String modelName, int bankid, String division, int seriesid, int product, int customType,
                        BigDecimal percentageDown, int scoreDown, String loanType, String area) {
        int count = modelDao.addModel(modelName, bankid, division, seriesid, product, customType, percentageDown,
                scoreDown, loanType, area);
        return count;
    }

    @Override
    public List<Map<String, Object>> getModelinfo(int id) {
        List<Map<String, Object>> modelList = modelDao.getModelinfo(id);
        return modelList;
    }

    @Override
    public int updateModelinfo(int id, String modelName, String division, BigDecimal percentageDown, int scoreDown,
                               String loanType, String area) {
        int count = modelDao.updateModelinfo(id, modelName, division, percentageDown, scoreDown, loanType, area);
        return count;
    }

    @Override
    public List<Map<String, Object>> getQuestionList(int id, int pageNo, int pageSize) {
        List<Map<String, Object>> questionList = modelDao.getQuestionList(id, pageNo, pageSize);
        return questionList;
    }

    @Override
    public Integer getQuestionSize(int id) {
        Integer questionSize = modelDao.getQuestionSize(id);
        return questionSize;
    }
}
